//
// Created by twetec on 25-9-1.
//
#include <network_prober/database/file_db_holder.h>

#include <gtest/gtest.h>
#include <tcmalloc/tcmalloc.h>

namespace tests::database {
namespace
{
struct BankAccount
{
    int balance;

    BankAccount(){};
    explicit BankAccount(const int balance): balance{balance}
    {

    }
};

struct BankAccountTest : public testing::Test
{
    BankAccount* accountPtr;

    BankAccountTest()
    {
        accountPtr = new BankAccount();
    }

    ~BankAccountTest()
    {
        delete accountPtr;
        accountPtr = nullptr;
    }
};

TEST_F(BankAccountTest, BankAccountStartsEmpty)
{
    EXPECT_EQ(0, accountPtr->balance);
}

TEST(TcmallocTest, mallocTest)
{
    void* p = tc_malloc(1024);
    std::cout << "Allocated 1KB at " << p << std::endl;
    tc_free(p);
    EXPECT_EQ(1, 1);
}

// class MemoryLeakChecker : public testing::EmptyTestEventListener
// {
// private:
//     /**
//      * 测试案例执行前 - 调用
//      * @param test_info
//      */
//     void OnTestStart(const testing::TestInfo& test_info) override
//     {
//         m_initiallyAllocated = database::FileDBHolder::
//     }
//
//     /**
//      * 测试案例执行后 - 调用
//      * @param test_info
//      */
//     void OnTestEnd(const testing::TestInfo& test_info) override
//     {
//         std::size_t diff = 0;
//
//         EXPECT_LE(diff, 0) << "内存溢出：" << diff << " unit(s) of class";
//     }
//
// private:
//     std::size_t m_initiallyAllocated{0};
// };

TEST(FileDBHolderTest, testGetProbeTaskResultsByUUIDsAndStartEndTime)
{
    EXPECT_EQ(1, 1);

    EXPECT_EQ(3, 3);
}

TEST(FileDBHolderTest, testBatchInsertProbeTaskResults)
{
    EXPECT_EQ(1, 1);

    EXPECT_EQ(2, 2);
}
}
}
